package com.carl.utils;

import redis.clients.jedis.Jedis;


public class RedisUtils {
    private static Jedis jedis;

    static {
        jedis = new Jedis();
    }

    public static void insertKV(String key, String val) {
        String result = jedis.set(key, val);
    }

    public static void deleteKey(String key) {
        jedis.del(key);
    }

    public static boolean exitsKey(String key) {
        return jedis.exists(key);
    }

    public static void main(String[] args){
        String key = "itcast";
//        insertKV("itcast","NB");
        System.out.println(" === key exist ====");
        boolean existFlag = exitsKey(key);
        System.out.println(" existFlag : " + existFlag);
        System.out.println(" %%% key delete %%%");
        deleteKey(key);

    }


}
